package com.wlt.controller;


import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class LoginController {
	//登录
	@RequestMapping("/login")
	public String login(HttpSession session,String username,String password) throws Exception{
		//调用service进行身份验证
		session.setAttribute("username", username);
		//重定向到商品列表页面
		return "redirect:/items/queryItems.do";
		
	}
	
	//退出
	@RequestMapping("/logout")
	public String logout(HttpSession session)throws Exception{
		//清楚session
		session.invalidate();
		//重定向到商品列表页面
		return "redirect:/items/queryItems.do";
		
	}
}
